class CreateStudentPlanEnrollments < ActiveRecord::Migration
  def self.up
    create_table :student_plan_enrollments do |t|
      t.references :student
      t.references :educational_plan
      t.references :academic_term

      t.timestamps
    end
    add_index(:student_plan_enrollments, [:student_id, :educational_plan_id, :academic_term_id],
      :unique => true, :name => "student_plan_enrollments_sid_epid_at_id")
  end

  def self.down
    remove_index(:student_plan_enrollments, :name => "student_plan_enrollments_sid_epid_at_id")
    drop_table :student_plan_enrollments
  end
end
